In multiprocessing computer systems where a plurality of processes have access to a system resource, which may be a unit of storage, or a register or a specific piece of system hardware, there are problems of access contention and resource integrity to be resolved. For example, in the case where the resource is a unit of storage, if one process is changing the content of the storage, then no other process should be allowed to access the resource until the first one has finished.
In prior art computer systems operating under a multi-tasking operating system, it is known to provide for multiple read access or an exclusive write access to a resource at any one time. This is achieved by means of global and local resource counts for counting the global number of permits for read access to a resource (i.e. the total number of read access permits for all processes to that resource) and the local number of read access permits for each process to that resource (i.e. for the number of read access permits by each process to that resource). The local resource counts for individual processes are needed in addition to the global resource count because each process may contain a plurality of "sub-processes" termed threads, each of which may require access independently to a resource. Write operations to a resource are only permitted when all the read access counts are zero for that resource. Sequential access to the read access counts can be guaranteed by the use of semaphores as is well known in the art; thus avoiding possible contention and integrity problems with regard to the counts.
A complication with the above system is that a process may be terminated early by the multi-tasking operating system in response to an abort instruction. The early aborting of a process can mean that some read accesses for that process are pending when it is aborted and consequently that the counts mentioned above may need to be reset in order to maintain system integrity. The termination of a process has typically been controlled by means of exit processing logic which is called by the operating system each time a process terminates.
A multiprocessing computer system is therefore known in which each of a plurality of processes can access at least one system resource, the multiprocessing computer system comprising:
local count means for each process to maintain a count of permits for that process to access said resource; PA1 global count means to maintain a count of permits for all processes to access said resource; PA1 update logic for sequentially updating an appropriate local count means and the global count means each time a process requests or relinquishes use of the resource; and PA1 exit logic for terminating a process including means for resetting the global count means. PA1 the update logic additionally comprises logic for storing expected local and global count values in first and second storage means respectively, before either of the appropriate local count means or the global count means are updated; and PA1 the exit logic additionally comprises logic for comparing the content of the first storage means to that of the appropriate local count means and for comparing the content of the second storage means to the global count means and, in dependence on the results of the comparisons, determining whether the process was terminated between the updating of the local and global count means. PA1 a) storing the expected value of the local variable in a first storage means and the expected value of the global variable in a second storage means; and then PA1 b) updating said local variable and said global variable sequentially, and PA1 c) if said process is terminated, determining whether the process was terminated between the updating of said local and global variables by comparing the content of the first storage means to that of the local variable and by comparing the content of the second storage means to that of the global variable and, if necessary, undertaking remedial action to correct the values of the variables.
It has been determined that the known mechanism for dealing with process termination is potentially vulnerable if the process terminates abnormally in between the updating of the local and global request counts as these operations are performed by separate machine instructions, with the result that the counts will not be consistent. The difficulty is to detect whether the process was in this vulnerable phase when it was terminated in order that the exit processing logic may take appropriate action.
An object of the invention is, therefore, to provide a multiprocessing system of the above type which can effectively deal with such abnormal process termination.